Crate wasmer_types
source ·Expand description
This are the common types and utility tools for using WebAssembly in a Rust environment.
This crate provides common structures such as Type
or Value
, type indexes
and native function wrappers with Func
.
Re-exports
pub use crate::compilation::target::CpuFeature;
pub use crate::compilation::target::Target;
pub use error::CompileError;
pub use error::DeserializeError;
pub use error::ImportError;
pub use error::MemoryError;
pub use error::MiddlewareError;
pub use error::ParseCpuFeatureError;
pub use error::PreInstantiationError;
pub use error::SerializeError;
pub use error::WasmError;
pub use error::WasmResult;
pub use crate::compilation::relocation::Relocation;
pub use crate::compilation::relocation::RelocationKind;
pub use crate::compilation::relocation::RelocationTarget;
pub use crate::compilation::relocation::Relocations;
pub use crate::compilation::section::CustomSection;
pub use crate::compilation::section::CustomSectionProtection;
pub use crate::compilation::section::SectionBody;
pub use crate::compilation::section::SectionIndex;
pub use crate::compilation::address_map::FunctionAddressMap;
pub use crate::compilation::address_map::InstructionAddressMap;
pub use crate::compilation::function::Compilation;
pub use crate::compilation::function::CompiledFunction;
pub use crate::compilation::function::CompiledFunctionFrameInfo;
pub use crate::compilation::function::CustomSections;
pub use crate::compilation::function::Dwarf;
pub use crate::compilation::function::FunctionBody;
pub use crate::compilation::function::Functions;
pub use crate::compilation::module::CompileModuleInfo;
pub use crate::compilation::symbols::Symbol;
pub use crate::compilation::symbols::SymbolRegistry;
pub use crate::compilation::unwind::CompiledFunctionUnwindInfo;
Modules
- Types for compilation.
- The entity module, with common helpers for Rust structures
- The WebAssembly possible errors
- The
lib
module defines astd
module that is identical whether thecore
or thestd
feature is enabled.
Macros
- Macro which provides the common implementation of a 32-bit entity reference.
Structs
- Units of WebAssembly memory in terms of 8-bit bytes.
- Index type of a custom section inside a WebAssembly module.
- Index type of a passive data segment inside the WebAssembly module.
- A data initializer for linear memory.
- A memory index and offset within that memory where a data initialization should be performed.
- Index type of a passive element segment inside the WebAssembly module.
- A descriptor for an exported WebAssembly value.
- This iterator allows us to iterate over the exports and offer nice API ergonomics over it.
- Controls which experimental features will be enabled. Features usually have a corresponding WebAssembly proposal.
- Description of a frame in a backtrace for a
RuntimeError
. - Index type of a function (imported or local) inside the WebAssembly module.
- The signature of a function that is either implemented in a Wasm module or exposed to Wasm by the host.
- Index type of a global variable (imported or local) inside the WebAssembly module.
- WebAssembly global.
- Hash key of an import
- A descriptor for an imported value into a wasm module.
- This iterator allows us to iterate over the imports and offer nice API ergonomics over it.
- Index type of a function defined locally inside the WebAssembly module.
- Index type of a global defined locally inside the WebAssembly module.
- Index type of a memory defined locally inside the WebAssembly module.
- Index type of a table defined locally inside the WebAssembly module.
- Marker trait for 32-bit memories.
- Marker trait for 64-bit memories.
- Index type of a linear memory (imported or local) inside the WebAssembly module.
- A descriptor for a WebAssembly memory type.
- Metadata header which holds an ABI version and the length of the remaining metadata.
- A translated WebAssembly module, excluding the function bodies and memory initializers.
- As
DataInitializer
but owning the data rather than holding a reference to it - The only error that can happen when converting
Bytes
toPages
- Units of WebAssembly pages (as specified to be 65,536 bytes).
- The compilation related data for a serialized modules
- Serializable struct that is able to serialize from and to a
ArtifactInfo
. - Index type of a signature (imported or local) inside the WebAssembly module.
- A source location.
- Unique ID to identify a context.
- Index type of a table (imported or local) inside the WebAssembly module.
- A WebAssembly table initializer.
- A descriptor for a table in a WebAssembly module.
- Target specific type for shared signature index.
- Information about trap.
- A target “triple”. Historically such things had three fields, though they’ve added additional fields over time.
- The WebAssembly V128 type
- An index type for builtin functions.
- This class computes offsets to fields within VMContext and other related structs that JIT code accesses directly.
Enums
- The “architecture” field, which in some cases also specifies a specific subarchitecture.
- The “binary format” field, which is usually omitted, and the binary format is implied by the other fields.
- The calling convention, which specifies things like which registers are used for passing arguments, which registers are callee-saved, and so on.
- The target memory endianness.
- The “environment” field, which specifies an ABI environment on top of the operating system. In many configurations, this field is omitted, and the environment is implied by the operating system.
- An entity to export.
- A list of all possible types which can be externally referenced from a WebAssembly module.
- Globals are initialized via the
const
operators or by referring to another import. - An entity to import.
- The name of a runtime library routine.
- Implementation styles for WebAssembly linear memory.
- Indicator of whether a global is mutable or not
- After the stack is unwound via asyncify what should the call loop do next
- The “operating system” field, which sometimes implies an environment, and sometimes isn’t an actual operating system.
- The width of a pointer (in the default address space).
- Implementation styles for WebAssembly tables.
- A trap code describing the reason for a trap.
- A list of all possible value types in WebAssembly.
- The “vendor” field, which in practice is little more than an arbitrary modifier.
Constants
- Version number of this crate.
- The number of pages we can have before we run out of byte index space.
- The minimum number of pages allowed.
- WebAssembly page sizes are fixed to be 64KiB. Note: large page support may be added in an opt-in manner in the future.
Traits
- Trait for the
Memory32
andMemory64
marker types. NativeWasmType
represents a Wasm type that has a direct representation on the host (hence the “native” term).- Trait for a Value type. A Value type is a type that is always valid and may be safely copied.
Functions
- Check if the provided bytes are wasm-like
Type Definitions
- Addend to add to the symbol value.
- Offset in bytes from the beginning of the function.
Unions
- Raw representation of a WebAssembly value.